public class Student {
	
	String id;
	String name;
	String gender;
	Course course;
	
	//构造方法
	public Student(String id,String name,String gender,Course course) {
		this.id = id;
		this.name = name;
		this.gender = gender;
	}
	
	//选课
	public void selectCourse(Course c) {
		if (course != null) {
			System.out.println(name+"已选过课程，不能重复选。");
		}else {
			course = c;
			c.student = this;
			System.out.println(name+"选课成功："+c.name);
		}
	}
	
	//退课
	public void dropCourse() {
		if(course == null) {
			System.out.println(name+"还没有选课程，无法退课。");
		}else {
			System.out.println(name+"已退课："+course.name);
			course.student = null;
			course = null;
		}
	}
	
	//打印学生课表
	public void showSchedule() {
		if(course != null){
			System.out.println("已选课程："+course.name);
			System.out.println("上课地点："+course.location);
			System.out.println("上课时间："+course.time);
			System.out.println("授课教师："+course.teacher.name);
		} else {
			System.out.println("暂无选课记录");
    	}
	}
}